create database A
go

use A
go

alter proc proc_SuiJiInsertName
@rownum int =1000,
@i int =0
as
begin
	
	 if OBJECT_ID('aInfo','U')is not null
		begin
			 drop table aInfo
		end
	  create table aInfo
	  (
		Id int primary key identity,
		Name nvarchar(80) not null,
		Birthday date not null default(getdate()) 
	  )
declare @name nvarchar(80),@Lastname nvarchar(80),@Firstname nvarchar(80)
	  while @i<@rownum
		   begin
			  execute proc_LastName @Lastname output
			  execute proc_FirstName @Firstname output
			  set @name= @Lastname+@Firstname		 
			  insert into aInfo(Name) values(@name)
			  set @i=@i+1
		   end
end
go

execute proc_SuiJiInsertName 10000
go
select * from ainfo 


go


alter proc proc_LastName  --�������
@Lastname nvarchar(80) output
as
begin
	  declare @str nvarchar(80)='��Ǯ��������֣���������������������������ʩ�ſײ��ϻ���κ�ս���л������ˮ��������˸��ɷ�����³Τ������ﻨ������Ԭ��ۺ��ʷ�Ʒ����Ѧ�׺����������ޱϺ�����������ʱ��Ƥ���뿵����Ԫ������ƽ�ƺ�������Ҧ��տ����ë�����ױ���갼Ʒ��ɴ�̸��é��'
	  declare @index int =rand()*len(@str)	  
	  set @Lastname=substring(@str,@index,1)
end

declare @res nvarchar(80)
execute proc_LastName @res output
select @res
go

alter proc proc_FirstName  
@Firstname nvarchar(80)output
as
begin
	  declare @str nvarchar(80)='��ǿ����������г����ƽ�ȹ������ΰ�����ҵ��������'
	  declare @index int =rand()*len(@str)+1
	  set @Firstname=substring(@str,@index,2) 
end

declare @res nvarchar(80)
execute proc_FirstName @res output
select @res 
go
